﻿using EasyBuyShop.Models;
using EasyBuyShop.Utils;

namespace EasyBuyShop.DAL
{
    public class ProductConfigDal : BaseDal
    {
        public ProductConfigDal()
        {
           
        }

        /// <summary>
        /// 获取产品配置
        /// </summary>
        /// <param name="productId"></param>
        /// <returns></returns>
        public List<ProductConfig> GetProductConfigListById(long productId)
        {
            try
            {
                using (var db = this.GetDb(BaseDal.ConnStr))
                {
                    return db.Queryable<ProductConfig>().Where(r => r.ProductId == productId).ToList();
                }
            }
            catch (Exception ex)
            {
                LogHelper.Fatal(ex.Message);
                return new List<ProductConfig>();
            }
        }
    }
}
